package com.leo.apptest.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.leo.apptest.R;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    private Button mBtFragmentCommunicate;
    private Button mBtLeak;
    private Button mBtLayoutInflater;
    private Button mBtService;
    private Button mBtParcelable;
    private Button mBtUtils;
    private Button mBtMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mBtFragmentCommunicate = (Button) findViewById(R.id.btFragmentCommunicate);
        mBtLeak = (Button) findViewById(R.id.btLeak);
        mBtLayoutInflater = (Button) findViewById(R.id.btRecycler);
        mBtService = (Button) findViewById(R.id.btService);
        mBtParcelable = (Button) findViewById(R.id.btParcelable);
        mBtUtils = (Button) findViewById(R.id.btUtils);
        mBtMap = (Button) findViewById(R.id.btMap);

        mBtFragmentCommunicate.setOnClickListener(this);
        mBtLeak.setOnClickListener(this);
        mBtLayoutInflater.setOnClickListener(this);
        mBtService.setOnClickListener(this);
        mBtParcelable.setOnClickListener(this);
        mBtUtils.setOnClickListener(this);
        mBtMap.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.btFragmentCommunicate:
                intent.setClass(this,RecyclerAnimActivity.class);
                break;
            case R.id.btLeak:
                intent.setClass(this,LeakCanaryActivity.class);
                break;
            case R.id.btRecycler:
                intent.setClass(this,LayoutInflaterActivity.class);
                break;
            case R.id.btService:
                intent.setClass(this,ServiceTestActivity.class);
                break;
            case R.id.btParcelable:
                intent.setClass(this,ParcelableSendActivity.class);
                break;
            case R.id.btUtils:
                intent.setClass(this,UtilsTestActivity.class);
                break;
            case R.id.btMap:
                intent.setClass(this,BitmapActivity.class);
                break;
        }
        startActivity(intent);
    }
}
